home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000329_arthur.marsh@adelaide.edu.au_Fri Aug 30 09:05:35 EDT 2002.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  94 lines

  1. Article: 13659 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!panix!news-out.cwix.com!newsfeed.cwix.com!news1.optus.net.au!optus!news.optus.net.au!53ab2750!not-for-mail
  3. From: Arthur Marsh <arthur.marsh@adelaide.edu.au>
  4. User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.1) Gecko/20020826
  5. X-Accept-Language: en-us, en
  6. MIME-Version: 1.0
  7. Newsgroups: comp.protocols.kermit.misc
  8. Subject: Re: scripting capturing of Cisco ARP tables
  9. References: <3d6e39ea@yorrell.saard.net> <aklgqn$2gv$1@watsol.cc.columbia.edu>
  10. Content-Type: text/plain; charset=us-ascii; format=flowed
  11. Content-Transfer-Encoding: 7bit
  12. X-Original-NNTP-Posting-Host: arthur-4100.its.adelaide.edu.au
  13. Message-ID: <3d6ed522$1@yorrell.saard.net>
  14. X-Original-Trace: 30 Aug 2002 11:44:58 +0950, arthur-4100.its.adelaide.edu.au
  15. Lines: 72
  16. Date: Fri, 30 Aug 2002 02:15:01 GMT
  17. NNTP-Posting-Host: 203.21.37.20
  18. X-Trace: news.optus.net.au 1030673701 203.21.37.20 (Fri, 30 Aug 2002 12:15:01 EST)
  19. NNTP-Posting-Date: Fri, 30 Aug 2002 12:15:01 EST
  20. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13659
  21.  
  22. Thanks, my rough, first working script is (with username, password and 
  23. ip addresses changed):
  24.  
  25. #!/usr/local/bin/kermit
  26. ; open log file
  27. fopen /write \%c arp.log
  28.    if fail exit
  29. ; declare router addresses
  30. dcl \&a[] = 129.127.134.254 129.127.135.125
  31.    for \%i 1 \fdim(&a) 1 {
  32.  
  33. close connection
  34. set telnet wait off
  35. set host \&a[\%i]
  36. if fail break
  37.  
  38. minput 10 "Username:"
  39. if fail break
  40.  
  41. lineout myname
  42.  
  43. minput 10 "Password:"
  44. if fail break
  45. lineout mypassword
  46.  
  47.          if equal \&a[\%i] 129.127.135.125 {
  48.            minput 10 "#" ">" ")"
  49.            if fail break
  50.            clear input
  51.            lineout session 15
  52.            minput 10 "router"
  53.            if fail break
  54.          }
  55. else {
  56. minput 10 "#" ">" ")"
  57. if fail break
  58. }
  59.  
  60.  
  61. lineout show arp              ; Send "show arp" and CR
  62.    set flag on                   ; Loop control
  63.    while flag {                  ; Loop
  64.        clear input               ; Clear INPUT buffer
  65.        minput 10 "\10" "--More--" ">" "#"  ; Wait for trigger strings
  66.        if fail break
  67.        switch \v(minput) {
  68.          :1, if equal "\fleft(\v(input),8)" "Internet" {
  69.                  fwrite \%c \v(input)
  70.              }
  71.              break
  72.          :2, output " "
  73.              break
  74.          :3, set flag off
  75.        }
  76.    }
  77.    }
  78.  
  79. close connection
  80. echo
  81. echo finished C-Kermit
  82. exit
  83.  
  84. A shell script then sorts and cleans the output and a Perl script 
  85. compares the data it with what was in an Oracle database, updating a 
  86. "lastarp_date" column of a table containing MAC addreeses of devices in 
  87. our network.
  88.  
  89. -- 
  90. Arthur Marsh, Network Support Officer, Information Technology Services
  91. The University of Adelaide SA 5005 Australia
  92. Ph: +61 8 8303 6109, Mobile: +61 414 260 077
  93.  
  94.